package com.turing.post.salesmanage.util;

import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

/**
 * 赎回单状态迁移明细
 * 
 * @author yxb
 * @date 2013-01-22
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "RedempOrderActionDetail")
@IdClass(RedempOrderActionDetail.class)
public class RedempOrderActionDetail implements java.io.Serializable {

	/**
	 * 0 - 确认录入赎回单
	 */
	public final static String RedOrdDetail_Type_Input = "0";
	/**
	 * 1 - 返回录入
	 */
	public final static String RedOrdDetail_Type_BackInput = "1";
	/**
	 * 2 - 取消赎回单
	 */
	public final static String RedOrdDetail_Type_Cancel = "2";
	/**
	 * 3 - 初审通过
	 */
	public final static String RedOrdDetail_Type_FirPass = "3";
	/**
	 * 4 - 赎回拒绝
	 */
	public final static String RedOrdDetail_Type_FirRefuse = "4";
	/**
	 * 5 - 终审通过
	 */
	public final static String RedOrdDetail_Type_SecPass = "5";
	/**
	 * 6 - 终审拒绝
	 */
	public final static String RedOrdDetail_Type_SecRefuse = "6";
	/**
	 * 7 - 扣帐
	 */
	public final static String RedOrdDetail_Type_ACC = "7";
	/**
	 * 8 - 扣帐失败撤销
	 */
	public final static String RedOrdDetail_Type_ACCCANCEL = "8";
	/**
	 * 9 - 付赎回款
	 */
	public final static String RedOrdDetail_Type_PAID = "9";

	private BigInteger redempOrderId;// (IDX,FK) 赎回单
	private Date actionTime;// 操作时间 Date Not Null 精确到秒
	private BigInteger operId;// 操作员ID int Not Null
	private String initialStatus;// 初始状态 char(1) Null
	private String endStatus;// 结束状态 char(1) Not Null
	private String actionType;// 操作类型 char(1) Not Null
	private String remark;

	public RedempOrderActionDetail() {

	}

	@Id
	@Column(name = "REDEMPORDERID")
	public BigInteger getRedempOrderId() {
		return redempOrderId;
	}

	public void setRedempOrderId(BigInteger redempOrderId) {
		this.redempOrderId = redempOrderId;
	}

	@Id
	@Column(name = "ACTIONTIME")
	public Date getActionTime() {
		return actionTime;
	}

	public void setActionTime(Date actionTime) {
		this.actionTime = actionTime;
	}

	@Column(name = "OPERID")
	public BigInteger getOperId() {
		return operId;
	}

	public void setOperId(BigInteger operId) {
		this.operId = operId;
	}

	@Column(name = "INITIALSTATUS")
	public String getInitialStatus() {
		return initialStatus;
	}

	public void setInitialStatus(String initialStatus) {
		this.initialStatus = initialStatus;
	}

	@Column(name = "ENDSTATUS")
	public String getEndStatus() {
		return endStatus;
	}

	public void setEndStatus(String endStatus) {
		this.endStatus = endStatus;
	}

	@Column(name = "ACTIONTYPE")
	public String getActionType() {
		return actionType;
	}

	public void setActionType(String actionType) {
		this.actionType = actionType;
	}

	@Column(name = "REMARK")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((getActionTime() == null) ? 0 : getActionTime().hashCode());
		result = prime
				* result
				+ ((getRedempOrderId() == null) ? 0 : getRedempOrderId()
						.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final RedempOrderActionDetail other = (RedempOrderActionDetail) obj;
		if (getActionTime() == null) {
			if (other.getActionTime() != null)
				return false;
		} else if (!getActionTime().equals(other.getActionTime()))
			return false;
		if (getRedempOrderId() == null) {
			if (other.getRedempOrderId() != null)
				return false;
		} else if (!getRedempOrderId().equals(other.getRedempOrderId()))
			return false;
		return true;
	}

}